package com.daily.study.controller;


import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

@Aspect
@Component
public class AopConfig {

    @Pointcut("@annotation(com.daily.study.controller.MyAop)")
    public void pt(){}

    @Around("pt()")
    public Object aopAround(ProceedingJoinPoint point){
        try {
            System.out.println("前置通知");
            point.proceed();
            System.out.println("point.toLongString()："+point.toLongString());
            System.out.println("point.getArgs() = " + point.getArgs());
            System.out.println("后置通知");
        } catch (Throwable throwable) {
            throwable.printStackTrace();
        }
        return null;
    }
}
